Volatile this keyword may have been heard by many friends, and may have been used. Before Java 5, it was a controversial keyword, because using it in a program often led to unexpected results. After Java 5, the volatile keyword was able to regain
Volatile reminds the compiler that the variables defined later can change at any time, so the compiled program will read the data directly from the variable address each time it needs to store or read the variable. If there is no volatile keyword,
12.2 The efficiency and consistency of the hardwareBecause the computer's storage device and the processor's operation speed has several orders of magnitude difference , Therefore, modern computer systems have to add a layer of read and write speeds
A variable defined as volatile means that this variable may be unexpectedly changed, so that the compiler will not assume the value of this variable. Precisely, the optimizer must carefully re-read the value of this variable every time when using
Because often see volatile this keyword, think of themselves not very clear about this volatile, just know that it shows that variables are easy to change and prevent compiler optimization. So on the Internet to find some other friends of the
A variable defined as volatile means that this variable may be unexpectedly changed, so that the compiler will not assume the value of this variable. Precisely, the optimizer must carefully re-read the value of this variable every time when using
The role of volatile (
Http://blog.21ic.com/user1/2949/archives/2007/35599.html)
173 recommendation
A variable defined as volatile means that this variable may be unexpectedly changed, so that the compiler will not assume the value of this variable.
A variable that is defined as volatile means that the variable may be unexpectedly changed so that the compiler does not assume the value of the variable. Precisely, the optimizer must carefully re-read the value of the variable each time it uses
A variable defined as volatile means that this variable may be unexpectedly changed, so that the compiler will not assume the value of this variable. Precisely, the optimizer must carefully re-read the value of this variable every time when using
Talk about the role of volatile 64 recommend a variable that is defined as volatile is that the variable may be unexpectedly altered so that the compiler does not assume the value of the variable. Precisely, the optimizer must carefully reread the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.